/*
 * @Description:
 * @Version: 1.0
 * @Author: Will
 * @Date: 2023-06-15 15:29:48
 * @LastEditors: MarsLay 331412466@qq.com
 * @LastEditTime: 2023-12-11 16:19:29
 * @FilePath: \nanhu-manage-pc\vue.config.js
 * Copyright (C) 2023 Will. All rights reserved.
 */
const { defineConfig } = require("@vue/cli-service");
const path = require("path");
const stylePath = path.resolve(__dirname, "./src/assets/css/mixin.less");

// 引入等比适配插件
const px2rem = require("postcss-px2rem");

// 配置基本大小
const postcss = px2rem({
  // 基准大小 baseSize，需要和rem.js中相同
  remUnit: 16,
});

module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: "./",
  outputDir: "dist",
  devServer: {
    // 解决页面弹出红色报错遮罩层
    client: {
      //将overlay设置为false即可
      overlay: false,
    },
  },
  css: {
    loaderOptions: {
      less: {
        globalVars: {
          hack: `true; @import '${stylePath}'`,
        },
        postcss: {
          plugins: [postcss],
        },
      },
      // postcss: {
      //   postcssOptions:{
      //     plugins:[
      //       require('postcss-pxtorem')({
      //         rootValue:16,
      //         selectorBlackList:['vant','mu'],
      //         propList:['*']
      //       })
      //     ]
      //   }
      // }
    },
  },
});
